<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>图解Http四返回结果的HTTP状态码 | 清风向阳</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
    <meta name="keywords" content="Joker,Joker's Blog" />
  
  <meta name="description" content="HTTP状态码负责表示客户端HTTP请求的返回结果，标记服务器端的处理是否正常、通知出现的错误等工作">
<meta name="keywords" content="HTTP">
<meta property="og:type" content="article">
<meta property="og:title" content="图解Http四返回结果的HTTP状态码">
<meta property="og:url" content="http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/index.html">
<meta property="og:site_name" content="清风向阳">
<meta property="og:description" content="HTTP状态码负责表示客户端HTTP请求的返回结果，标记服务器端的处理是否正常、通知出现的错误等工作">
<meta property="og:image" content="http://jokero1o.github.io/images/blog_http_4-1.png">
<meta property="og:updated_time" content="2017-09-15T06:59:59.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="图解Http四返回结果的HTTP状态码">
<meta name="twitter:description" content="HTTP状态码负责表示客户端HTTP请求的返回结果，标记服务器端的处理是否正常、通知出现的错误等工作">
<meta name="twitter:image" content="http://jokero1o.github.io/images/blog_http_4-1.png">
  
  
    <link rel="icon" href="/favicon_pic.ico">
  
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css">
  <script src="/js/pace.min.js"></script>
  

  
  

</head>

<body>
  <div id="container">
      <header id="header">
    <div id="banner"></div>
    <div id="header-outer">
        <div id="header-menu" class="header-menu-pos animated">
            <div class="header-menu-container">
                <a href="/" class="left">
                    <span class="site-title">Joker&#39;s Blog</span>
                </a>
                <nav id="header-menu-nav" class="right">
                    
                    <a  href="/">
                        <i class="fa fa-home"></i>
                        <span>Home</span>
                    </a>
                    
                    <a  href="/archives">
                        <i class="fa fa-archive"></i>
                        <span>Archives</span>
                    </a>
                    
                    <a  href="/about">
                        <i class="fa fa-user"></i>
                        <span>About</span>
                    </a>
                    
                </nav>
                <a class="mobile-header-menu-button">
                    <i class="fa fa-bars"></i>
                </a>
            </div>
        </div>
        <div id="header-row">
            <div id="logo">
                <a href="/">
                    <img src="/images/avatar.jpg" alt="logo">
                </a>
            </div>
            <div class="header-info">
                <div id="header-title">
                    
                    <h2>
                        Joker&#39;s Blog
                    </h2>
                    
                </div>
                <div id="header-description">
                    
                    <h3>
                        一个认真的技术博客
                    </h3>
                    
                </div>
            </div>
            <nav class="header-nav">
                <div class="social">
                    
                        <a title="Joker"  href="//joker-studio.pub">
                            <i class="fa fa-home fa-2x"></i></a>
                    
                        <a title="Github" target="_blank" href="//github.com/mjjde">
                            <i class="fa fa-github fa-2x"></i></a>
                    
                </div>
            </nav>
        </div>
    </div>
</header>
      <div class="outer">
        <section id="main" class="body-wrap"><article id="post-图解Http四返回结果的HTTP状态码" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="post-title" itemprop="name">
      图解Http四返回结果的HTTP状态码
    </h1>
    <div class="post-title-bar">
      <ul>
          
              <li>
                  <i class="fa fa-book"></i>
                  
                      <a href="/categories/网络技术/">网络技术</a>
                  
              </li>
          
        <li>
          <i class="fa fa-calendar"></i>  2017-05-04
        </li>
        <li>
          <i class="fa fa-eye"></i>
          <span id="busuanzi_value_page_pv"></span>
        </li>
      </ul>
    </div>
  

          
      </header>
    
    <div class="article-entry post-content" itemprop="articleBody">
      
            
            <blockquote>
<p>HTTP状态码负责表示客户端HTTP请求的返回结果，标记服务器端的处理是否正常、通知出现的错误等工作<br><a id="more"></a></p>
</blockquote>
<h3 id="状态码告知从服务端返回的请求结果"><a href="#状态码告知从服务端返回的请求结果" class="headerlink" title="状态码告知从服务端返回的请求结果"></a><a href="#u72B6_u6001_u7801_u544A_u77E5_u4ECE_u670D_u52A1_u7AEF_u8FD4_u56DE_u7684_u8BF7_u6C42_u7ED3_u679C" title="状态码告知从服务端返回的请求结果"></a>状态码告知从服务端返回的请求结果</h3><p>状态码是用来告知客户端发送给服务端的请求的处理情况，借助状态码可以知道服务端请求是正常的还是出现了错误</p>
<p><img src="http://jokero1o.github.io/images/blog_http_4-1.png" alt=""></p>
<h3 id="2XX成功"><a href="#2XX成功" class="headerlink" title="2XX成功"></a><a href="#2XX_u6210_u529F" title="2XX成功"></a>2XX成功</h3><p>2XX的响应结果表明请求被正常处理了。</p>
<ol>
<li>204 No Content<br>该状态码代表服务器接收的请求已成功处理，但在返回的响应报文中不含实体的主体部分。<br>一般在只需要从客户端向服务器发送信息，而对客户端不需要发送新信息内容的情况下使用</li>
<li>206 Partial Content<br>该状态码表示客户端进行了范围请求，而服务器成功执行了这部分的GET请求。响应报文中包含由 Content-Range 指定范围的实体内容</li>
</ol>
<h3 id="3XX重定向"><a href="#3XX重定向" class="headerlink" title="3XX重定向"></a><a href="#3XX_u91CD_u5B9A_u5411" title="3XX重定向"></a>3XX重定向</h3><p>3XX响应结果表明浏览器需要执行某些特殊的处理以正确处理请求。</p>
<ol>
<li>301 Moved Permanently<br>永久性重定向。该状态码表示请求的资源已被分配了新的URI，以后应使用资源现在所指的URI</li>
<li>302 Found<br>临时性重定向。该状态码表示请求的资源已被分配了新的URI，希望用户(本次)能使用新的 URI访问</li>
<li>303 See Other<br>该状态码表示由于请求对应的资源存在着另一个URI，应使用GET方法定向获取请求的资源</li>
<li>304 Not Modified<br>该状态码表示客户端发送附带条件的请求时，服务器端允许请求访问资源，但未满足条件的情况</li>
<li>307 Temporary Redirect<br>临时重定向。该状态码与302 Found有着相同的含义。尽管302标准禁止POST变成GET，但实际使用时大家并不遵守。</li>
</ol>
<h3 id="4XX客户端错误"><a href="#4XX客户端错误" class="headerlink" title="4XX客户端错误"></a><a href="#4XX_u5BA2_u6237_u7AEF_u9519_u8BEF" title="4XX客户端错误"></a>4XX客户端错误</h3><p>4XX的响应结果表明客户端是发生错误的原因所在。</p>
<ol>
<li>400 Bad Request<br>该状态码表示请求报文中存在语法错误。当错误发生时，需修改请求的内容后再发送请求。</li>
<li>401 Unauthorized<br>该状态码表示发送的请求需要有通过HTTP认证(BASIC 认证、 DIGEST 认证)的认证信息</li>
<li>403 Forbidden<br>该状态码表明对请求资源的 问被服务器拒绝了</li>
<li>404 Not Found<br>该状态码表明服务器上无法找到请求的资源</li>
</ol>
<h3 id="5XX-服务器错误"><a href="#5XX-服务器错误" class="headerlink" title="5XX 服务器错误"></a><a href="#5XX__u670D_u52A1_u5668_u9519_u8BEF" title="5XX 服务器错误"></a>5XX 服务器错误</h3><p>5XX的响应结果表明服务器本身发生错误</p>
<ol>
<li>500 Internal Server Error<br>该状态码表明服务器端在执行请求时发生了错误。也有可能是Web应用存在的bug或某些临时的错误。</li>
<li>503 Service Unavailable<br>该状态码表明服务器暂时处于超负荷或正在进行停机维，现在无法处理请求</li>
</ol>

            <div class="post-copyright">
    <div class="content">
        <p>最后更新： 2017年09月15日 14:59</p>
        <p>原始链接： <a class="post-url" href="/2017/05/04/图解Http四返回结果的HTTP状态码/" title="图解Http四返回结果的HTTP状态码">http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/</a></p>
        <footer>
            <a href="http://mjjde.github.io">
                <img src="/images/avatar.jpg" alt="Joker Mei">
                Joker Mei
            </a>
        </footer>
    </div>
</div>

      
    </div>
    <footer class="article-footer">
        
        
<div class="post-share">
    <a href="javascript:;" id="share-sub" class="post-share-fab">
        <i class="fa fa-share-alt"></i>
    </a>
    <div class="post-share-list" id="share-list">
        <ul class="share-icons">
          <li>
            <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/&title=《图解Http四返回结果的HTTP状态码》 — 清风向阳&pic=http://mjjde.github.ioimages/avatar.jpg" data-title="微博">
              <i class="fa fa-weibo"></i>
            </a>
          </li>
          <li>
            <a class="weixin share-sns" id="wxFab" href="javascript:;" data-title="微信">
              <i class="fa fa-weixin"></i>
            </a>
          </li>
          <li>
            <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/&title=《图解Http四返回结果的HTTP状态码》 — 清风向阳&source=
HTTP状态码负责表示客户端HTTP请求的返回结果，标记服务器端的处理是否正常、通知出现的错误等工作" data-title="QQ">
              <i class="fa fa-qq"></i>
            </a>
          </li>
          <li>
            <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/" data-title="Facebook">
              <i class="fa fa-facebook"></i>
            </a>
          </li>
          <li>
            <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《图解Http四返回结果的HTTP状态码》 — 清风向阳&url=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/&via=http://mjjde.github.io" data-title="Twitter">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
          <li>
            <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/" data-title="Google+">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        </ul>
     </div>
</div>
<div class="post-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;" id="wxShare-close">×</a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=http://mjjde.github.io/2017/05/04/图解Http四返回结果的HTTP状态码/" alt="微信分享二维码">
</div>

<div class="mask"></div>

        
        <ul class="article-footer-menu">
            
            
  <li class="article-footer-tags">
    <i class="fa fa-tags"></i>
      
    <a href="/tags/HTTP/" class="color5">HTTP</a>
      
  </li>

        </ul>
        
    </footer>
  </div>
</article>


    <aside class="post-toc-pos post-toc-top" id="post-toc">
        <nav class="post-toc-wrap">
            <ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#状态码告知从服务端返回的请求结果"><span class="post-toc-text">状态码告知从服务端返回的请求结果</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#2XX成功"><span class="post-toc-text">2XX成功</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#3XX重定向"><span class="post-toc-text">3XX重定向</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#4XX客户端错误"><span class="post-toc-text">4XX客户端错误</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#5XX-服务器错误"><span class="post-toc-text">5XX 服务器错误</span></a></li></ol>
        </nav>
    </aside>
    

<nav id="article-nav">
  
    <a href="/2017/05/05/图解Http五与HTTP协作的Web服务器/" id="article-nav-newer" class="article-nav-link-wrap">

      <span class="article-nav-title">
        <i class="fa fa-hand-o-left" aria-hidden="true"></i>
        
          图解Http五与HTTP协作的Web服务器
        
      </span>
    </a>
  
  
    <a href="/2017/04/29/图解Http三HTTP报文内的HTTP信息/" id="article-nav-older" class="article-nav-link-wrap">
      <span class="article-nav-title">图解Http三HTTP报文内的HTTP信息</span>
      <i class="fa fa-hand-o-right" aria-hidden="true"></i>
    </a>
  
</nav>



    
</section>
        
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info" class="inner">
      
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


      <p>
        Powered by  <a href="http://hexo.io/" target="_blank">Hexo</a>
        Theme <a href="//github.com/wongminho/hexo-theme-miho" target="_blank">MiHo</a>
      &copy; 2018 Joker Mei<br>
      </p>
    </div>
  </div>
</footer>
    <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
  var mihoConfig = {
      root: "http://mjjde.github.io",
      animate: false,
      isHome: false,
      share: true
  }
</script>
<div class="sidebar">
    <!-- <div id="sidebar-search" title="Search">
        <i class="fa fa-search"></i>
    </div> -->
    <div id="sidebar-category" title="Categories">
        <i class="fa fa-book"></i>
    </div>
    <div id="sidebar-tag" title="Tags">
        <i class="fa fa-tags"></i>
    </div>
    <div id="sidebar-top">
        <span class="sidebar-top-icon"><i class="fa fa-angle-up"></i></span>
    </div>
</div>
<div class="sidebar-menu-box" id="sidebar-menu-box">
    <div class="sidebar-menu-box-container">
        <div id="sidebar-menu-box-categories">
            <a class="category-link" href="/categories/Android技术/">Android技术</a><a class="category-link" href="/categories/其他技术/">其他技术</a><a class="category-link" href="/categories/网络技术/">网络技术</a><a class="category-link" href="/categories/设计模式/">设计模式</a>
        </div>
        <div id="sidebar-menu-box-tags">
            <a href="/tags/Activity/" style="font-size: 10px;">Activity</a> <a href="/tags/Android/" style="font-size: 16px;">Android</a> <a href="/tags/Android-IPC/" style="font-size: 10px;">Android-IPC</a> <a href="/tags/Binder/" style="font-size: 16px;">Binder</a> <a href="/tags/DiskLruCache/" style="font-size: 10px;">DiskLruCache</a> <a href="/tags/Fragment/" style="font-size: 10px;">Fragment</a> <a href="/tags/HTTP/" style="font-size: 20px;">HTTP</a> <a href="/tags/Java/" style="font-size: 10px;">Java</a> <a href="/tags/Notification/" style="font-size: 10px;">Notification</a> <a href="/tags/RemoteView/" style="font-size: 10px;">RemoteView</a> <a href="/tags/Rxjava/" style="font-size: 14px;">Rxjava</a> <a href="/tags/ServiceManager/" style="font-size: 14px;">ServiceManager</a> <a href="/tags/android/" style="font-size: 12px;">android</a> <a href="/tags/gradle/" style="font-size: 10px;">gradle</a> <a href="/tags/java/" style="font-size: 18px;">java</a> <a href="/tags/other/" style="font-size: 10px;">other</a> <a href="/tags/volley/" style="font-size: 12px;">volley</a> <a href="/tags/widget/" style="font-size: 10px;">widget</a> <a href="/tags/事件/" style="font-size: 10px;">事件</a> <a href="/tags/组件化/" style="font-size: 10px;">组件化</a> <a href="/tags/设计模式/" style="font-size: 18px;">设计模式</a>
        </div>
    </div>
    <a href="javascript:;" class="sidebar-menu-box-close">&times;</a>
</div>
<div class="mobile-header-menu-nav" id="mobile-header-menu-nav">
    <div id="mobile-header-menu-container">
        <span class="title">Menu</span>
        <ul class="mobile-header-menu-navbar">
            
            <li>
                <a  href="/">
                    <i class="fa fa-home"></i><span>Home</span>
                </a>
            </li>
            
            <li>
                <a  href="/archives">
                    <i class="fa fa-archive"></i><span>Archives</span>
                </a>
            </li>
            
            <li>
                <a  href="/about">
                    <i class="fa fa-user"></i><span>About</span>
                </a>
            </li>
            
        </ul>
    </div>
</div>
<div class="search-wrap">
    <span class="search-close">&times;</span>
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
            <i class="icon icon-lg icon-chevron-left"></i>
        </a>
        <input class="search-field" placeholder="Search..." id="keywords">
        <a id="search-submit" href="javascript:;">
            <i class="fa fa-search"></i>
        </a>
    <div class="search-container" id="search-container">
        <ul class="search-result" id="search-result">
        </ul>
    </div>
</div>

<div id="search-tpl">
    <li class="search-result-item">
        <a href="{url}" class="search-item-li">
            <span class="search-item-li-title" title="{title}">{title}</span>
        </a>
    </li>
</div>
<script src="/js/search.js"></script>
<script src="/js/main.js"></script>








  </div>
</body>
</html>